{include file="public/header" /}


<!-- 工时费审核 -->
<style>
    body {
        background: #FFF;
    }
</style>

<div class="page">
    <a href="javascript:history.go(-1)" class="btn" title="返回上一步">返回上一步</a>
    <table class="ds-default-table order">
        <tbody>
            <!--  <tr class="space">
            <th colspan="2">{$Think.lang.order_detail}</th>
        </tr> -->
            <tr>
                <th>{$Think.lang.order_info}</th>
            </tr>
            <tr>
                <td colspan="2">
                    <ul>
                        <li><strong>{$Think.lang.ds_order_sn}:</strong>{$order_info.order_sn}</li>
                        <li><strong>{$Think.lang.order_state}:</strong>{$order_state[$order_info.order_state]}</li>
                        <li><strong>订单类型:</strong>{$order_type[$order_info.order_type]}</li>
                        <li><strong>订单预约时间:</strong>{$order_info.appointment_time}</li>
                        <li><strong>订单创建时间:</strong>{$order_info.add_time|date="Y-m-d H:i:s",###}</li>
                        <li><strong>订单备注:</strong>{$order_info.remarks}</li>
                    </ul>
                </td>
            </tr>


            {notempty name="order_info.address"}
            <tr>
                <th>客户信息</th>
            </tr>
            <tr>
                <td>
                    <ul>
                        <li><strong>客户姓名{$Think.lang.ds_colon}</strong>{$order_info.address.address_realname}</li>
                        <li><strong>客户电话:</strong>{$order_info.address.address_tel_phone}</li>
                        <li><strong>客户地址{$Think.lang.ds_colon}</strong>{$order_info.address.area_info}&nbsp;{$order_info.address.address_detail}&nbsp;
                        </li>
                    </ul>
                </td>
            </tr>
            {/notempty}

            {notempty name="order_info.fuwu"}
            <tr>
                <th>服务人员信息</th>
            </tr>
            <tr>
                <td>
                    <ul>
                        <li><strong>服务人员姓名{$Think.lang.ds_colon}</strong>{$order_info.fuwu.name}</li>
                        <li><strong>服务人员手机号:</strong>{$order_info.fuwu.phone}</li>
                        <li><strong>客户地址{$Think.lang.ds_colon}</strong>{$order_info.fuwu.address}</li>
                    </ul>
                </td>
            </tr>
            {/notempty}

            <tr>
                <th>服务设备列表
                </th>
            </tr>

            <tr>
                <td>
                    <table class="ds-default-table goods ">
                        <tbody>
                            <tr>
                                <th class="align-center">设备编号</th>
                                <th class="align-center">设备名称</th>
                                <th class="align-center">品牌</th>
                                <th class="align-center">操作</th>
                            </tr>
                            {foreach name="$service_info.goods_items" item="goods"}
                            <tr>
                                <td class="w20 align-center">
                                    <p>{$goods.goods_id}</p>
                                </td>
                                <td class="w20 align-center">
                                    <p>{$goods.goods_name}</p>
                                </td>
                                <td class="w20 align-center"><span class="red_common">{$goods.b_name}</span></td>
                                <td class="w96 align-center">
                                    <a href="javascript:dsLayerOpen('{:url('Service/show_detail',['id'=>$goods.id])}','{$Think.lang.ds_view} 子订单详情')"
                                        class="dsui-btn-view"><i class="iconfont"></i>{$Think.lang.ds_view}</a>
                                </td>

                            </tr>
                            {/foreach}
                        </tbody>
                    </table>
                </td>
            </tr>

            {notempty name="service_info.append_goods_items"}
            <tr>
                <th>追加服务设备列表</th>
            </tr>
            <tr>
                <td>
                    <table class="ds-default-table goods ">
                        <tbody>
                            <tr>
                                <th class="align-center">设备编号</th>
                                <th class="align-center">设备名称</th>
                                <th class="align-center">品牌</th>
                                <th class="align-center">提交人</th>
                                <th class="align-center">状态</th>
                                <th class="align-center">操作</th>
                            </tr>

                            {foreach name="$service_info.append_goods_items" item="goods"}
                            <tr>
                                <td class="w20 align-center">
                                    <p>{$goods.goods_id}</p>
                                </td>
                                <td class="w20 align-center">
                                    <p>{$goods.goods_name}</p>
                                </td>
                                <td class="w20 align-center"><span class="red_common">{$goods.b_name}</span></td>
                                <td class="w20 align-center">
                                    <p>
                                        {if $goods.is_backstage eq '0'}
                                        后台添加
                                        {else /}
                                        前台添加
                                        {/if}
                                    </p>
                                </td>
                                <td class="w20 align-center">
                                    <p>{$son_order_state[$goods.order_state]}</p>
                                </td>
                                <td class="w96 align-center">
                                    <a href="javascript:dsLayerOpen('{:url('Service/show_detail',['id'=>$goods.id])}','{$Think.lang.ds_view} 子订单详情')"
                                        class="dsui-btn-view"><i class="iconfont"></i>{$Think.lang.ds_view}</a>
                                </td>

                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </td>
            </tr>
            {/notempty}



            {notempty name="order_log"}
            <tr>
                <th>{$Think.lang.order_handle_history}</th>
            </tr>
            {foreach name="order_log" item="val"}
            <tr>
                <td>
                    {$val.log_role} {$val.log_user}&emsp;{$Think.lang.order_show_at}&emsp;{$val.log_time|date="Y-m-d
                    H:i:s",###}&emsp;{$val.log_msg}
                </td>
            </tr>
            {/foreach}
            {/notempty}

            <tr>
                <th>审核是否通过</th>
            </tr>
            <form id="store_form" method="post" novalidate="novalidate">
                <table class="ds-default-table">
                    <!--店主账号-->
                    <tbody>
                        <!--状态-->
                        <input type="hidden" name="order_id" value={$order_info.order_id}>
                        <input type="hidden" name="hour_id" value={$order_info.id}>
                        <tr class="noborder" style="background: rgb(255, 255, 255);">
                            <td class="required">追加工时数: </td>
                            <td class="vatop rowform">{$order_info.add_hours}</td>
                        </tr>
                        <tr class="noborder" style="background: rgb(255, 255, 255);">
                            <td class="required">追加时间: </td>
                            <td class="vatop rowform">{$order_info.created_at|date="Y-m-d H:i:s",###}</td>
                        </tr>
                        <tr class="noborder" style="background: rgb(255, 255, 255);">
                            <td class="required">追加原因: </td>
                            <td class="vatop rowform">{$order_info.additional_reasons_name}</td>
                        </tr>
                        <tr class="noborder" style="background: rgb(255, 255, 255);">
                            <td class="required">追加说明: </td>
                            <td class="vatop rowform">{$order_info.add_remarks}</td>
                        </tr>


                        <tr class="noborder" style="background: rgb(255, 255, 255);">
                            <td class="w120"><label class="" for="">审核是否通过:</label></td>
                            <td class="vatop rowform onoff" id="check">

                                <select name="order_state" id="order_state">
                                    <option value="1">通过</option>
                                    <option value="2">未通过</option>
                                </select>

                            </td>

                            <td class="vatop tips"></td>
                        </tr>

                        <!--关闭原因-->
                        <tr class="noborder" id="tr_store_close_info" style="display: none;">
                            <td class="w120"><label class="" for="">审核失败原因:</label></td>
                            <td class="vatop rowform"><textarea name="examine_failed_reason" rows="6" class="tarea"
                                    id="store_close_info"></textarea></td>
                            <td class="vatop tips"></td>
                        </tr>

                        <tr class="noborder" style="background: rgb(255, 255, 255);" id="dors">
                            <td class="required">每工时收费: </td>
                            <td class="vatop rowform"><input type="text" value="0" name="payper_hour" id="brand_sort"
                                    class="txt"></td>
                            <td class="vatop tips">请输入数字</td>
                        </tr>

                    </tbody>
                    <tfoot>
                        <tr class="tfoot">
                            <td colspan="15"><input class="btn" type="submit" value="提交"></td>
                        </tr>
                    </tfoot>
                </table>
            </form>
        </tbody>
    </table>
</div>

<script>
    $(document).ready(function () {
        $("form").submit(function (e) {
            var status = $('#order_state').val();
            var store_close_info = $('#store_close_info').val();
            var brand_sort = $('#brand_sort').val();
            if (status == 1) {
                if (brand_sort == 0) {
                    layer.msg('请填写每工时收费');
                    return false;
                }
                if (brand_sort < 0) {
                    layer.msg('请正确填写每工时收费');
                    return false;
                }
            }

            if (status == 2 && store_close_info.replace(/\s+/g, "") == '') {
                layer.msg('请填写审核失败原因');
                return false;
            }

        });
    });

    $(function () {
        $('#order_state').change(function () {
            if ($(this).val() == '2') {
                $('#tr_store_close_info').show();
                $('#dors').hide();

            } else {
                $('#tr_store_close_info').hide();
                $('#dors').show();
            }
        });
    });
</script>